from django.apps import AppConfig
from django.core.checks import register, Tags
from django.utils.translation import gettext_lazy as _

from django_site.checks import check_ceph_settings


class CephConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'ceph'
    default = True
    default_app_config = 'apps.ceph.apps.CephConfig'  # 升级后修改
    verbose_name = _('全局配置')

    def ready(self):
        # 服务启动后的ceph初始化的操作
        from ceph import ceph_settings
        ceph_settings.ceph_settings_update()
        ceph_settings.setup_global_config()
        register(check_ceph_settings, Tags.security, deploy=True)
